package com.fzg.controller;


import com.fzg.common.enums.ResponseWrapper;
import com.fzg.service.UserCollectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author fzg
 * @since 2022-07-05
 */
@RestController
@RequestMapping("/user-collect")
public class UserCollectController {

    @Autowired
    private UserCollectService userCollectService;

    /**
     * 当前登陆的用户收藏日记
     * @param diaryAid 日记Aid
     * @return ResponseWrapper
     */
    @PostMapping("/currentUserCollectCurrentDiary")
    public ResponseWrapper currentUserCollectCurrentDiary(HttpServletRequest request, @RequestParam Integer diaryAid){
        return userCollectService.currentUserCollectCurrentDiary(request,diaryAid);
    }

    /**
     * 当前登陆的用户取消收藏日记
     * @param diaryAid 日记Aid
     * @return ResponseWrapper
     */
    @PostMapping("/userCancelCollectDiary")
    public ResponseWrapper userCancelCollectDiary(HttpServletRequest request, @RequestParam Integer diaryAid){
        return userCollectService.userCancelCollectDiary(request,diaryAid);
    }

}
